import {
	getSysParam,
	getAppConfig
} from "_a/sms";
import store from "@/store/index.js";
export default {
	data() {
		return {
			noConfig: false //是否有配置app信息
		}
	},
	computed: {
		appConfig() {
			return this.$store.getters.appConfig || null
		}
	},
	async created() {
		// #ifdef H5
		let hostname = window.location.hostname
		// let hostname = '109more.shengdianbaobei.top'
		if (!this.appConfig) {
			this.$tip.loading('加载中....')
			let res = await getAppConfig({
				url: hostname
			})
			console.log(111,{res});
			// let res = await getSysParam('yfsplus')
			if (res.data && res.code == 200) {
				this.$store.commit('SETAppConfig', res.data)
			} else {
				// this.$tip.toast('未配置app,请联系管理员!')
				this.noConfig = true
				this.$store.commit('SETAppConfig', null)
			}
			this.$tip.loaded()
		} else {
			let res = await getAppConfig({
				url: hostname
			})
			if (res.data && res.code == 200) {
				this.$store.commit('SETAppConfig', res.data)
			} else {
				this.$store.commit('SETAppConfig', null)
				// this.$tip.toast('未配置app,请联系管理员!')
				this.noConfig = true
			}
		}
		// #endif
		
		// #ifdef APP-PLUS
		console.log('app相关信息')
		// let agentInfo = this.$store.getters.userInfo
		let appId = uni.getStorageSync('appId');
		console.log(appId)
		let res = await getAppConfig({
			uniappId: appId
		})
		if (res.data && res.code == 200) {
			this.$store.commit('SETAppConfig', res.data)
		} else {
			this.$store.commit('SETAppConfig', null)
			// this.$tip.toast('未配置app,请联系管理员!')
			this.noConfig = true
		}
		// #endif
		
		// 加载页面逻辑
		this.loadData()
	},

	methods: {

		loadData() {},
	}
}